package com.orkun.api.converter.core;

// Base class for models
public abstract class AbsModel {
  
  /** Filter predicate for model
   * @param field model field on which the filter is to be applied
   * @param value value to match with
   * @return boolean indicating whether a model matches the filtering criteria 
   * @throws Exception thrown in case of inapplicable field
   */
  public abstract boolean filterBy(String field, String value) throws Exception;
 
  /** Compare this model with another for ordering (similar to compareTo)
   * @param other a model to compare to
   * @param sort order used in sorting (e.g. Sort.ASC)
   * @return compareTo will return 1 or -1 
   * @throws Exception thrown in case of inapplicable field
   */
  public abstract int compareBy(AbsModel other, Sort sort) throws Exception;
}
